package com.abstract1;

abstract class Animal{
	abstract void eating();
	abstract void sleeping();
}
abstract class Dog extends Animal{
	void eating(){
		System.out.println("Dog is eaging");
	}
}
class MyDog extends Dog{

	@Override
	void sleeping() {
		System.out.println("MyDog is Sleeping");
		
	}
	
}
abstract class Cat extends Animal{
	void sleeping(){
		System.out.println("Cat is Sleeping");
	}
}
class MyCat extends Cat{

	@Override
	void eating() {
		System.out.println("MyCat is eaging");
		
	}
	
}
class AnimalFactory{

	static Animal getAnimal(int a){
		Animal ani=null;
		if(a==1){
			ani=new MyDog();
		}else if(a==2){
			ani=new MyCat();
		}
		return ani;
	}
}
enum ConstantEnum{
	DOG(1),CAT(2);
	int type;
	
	public int getType() {
		return type;
	}

	/*public void setType(int type) {
		this.type = type;
	}*/

	ConstantEnum(int type){
		this.type=type;
	}
}
public class TestAnimalClass {
public static void main(String[] args) {
	Animal ani=null;
	ani=AnimalFactory.getAnimal(Constant.DOG);
	showAnimal(ani);
	ani=AnimalFactory.getAnimal(Constant.CAT);
	showAnimal(ani);
}
public static void showAnimal(Animal ani){
	ani.eating();
	ani.sleeping();
}
}
